package com.server.protocol;

import java.nio.ByteBuffer;

import com.nio.io.Request;
import com.nio.io.Response;
import com.nio.protocol.Protocol;

public class LoginResp extends Protocol {

  private static final short PTL_ID=0x0002;

  private int result;

  public LoginResp() {
  }

  public LoginResp(int result) {
    this.result=result;
  }

  @Override
  public void decode(Request req) {
  }

  @Override
  public void encode(Response resp) {
    ByteBuffer buf=ByteBuffer.allocate(1024);
    buf.putInt(result);
    buf.flip();
    resp.setData(buf);
  }

  @Override
  public Protocol execute() {
    return null;
  }

  @Override
  public short getProtocolId() {
    return PTL_ID;
  }
}
